/**
* Copyrights 2011 Michal Saman, m.saman@designplus.cz.
* This source code is release under the Apache License 2.0.
* http://www.apache.org/licenses/LICENSE-2.0
*
* @file	 mem.h
* @brief Memory space routines
*/
#ifndef MEM_H
#define MEM_H

#include <env.h>
#include <stdint.h>
#include <proc/process.h>

/**
 * Structure for stack description.
 */
typedef struct stack {
	size_t 		size;				/*<< size of stack */
	uint32_t	start_address;			/*<< start of stack in memory */
} stack_t;

extern uint32_t _init_stack_addr;
extern stack_t	_kstack;

extern int move_stack(void* new_stack_addr, void* old_stack_addr, uint32_t stack_size, stack_t* new_stack);
extern int clone_memspace(process_t *sp, process_t *dp);

#define switch_memspace(p)	\
	vmu_switch_page_dir((struct page_directory *)p->pcontext.page_dir);

#endif
